#include "enemyplane.h"
#include"file.h"
enemyplane::enemyplane() {
    m_type = rand() % 5 + 1;
    switch(m_type) {
    case 1:
        m_enemy.load(":/small.png");
        break;
    case 2:
        m_enemy.load(":/small2.png");
        break;
    case 3:
        m_enemy.load(":/small3.png");
        break;
    case 4:
        m_enemy.load(":/small4.png");
        break;
    case 5:
        m_enemy.load(":/small2.png");
        break;
    default:
        m_enemy.load(":/small4.png");
    }
    m_x=0;
    m_y=0;
    m_free=true;
    m_speed=EMENY_SPEED;
    m_Rect.setWidth(m_enemy.width());
    m_Rect.setHeight(m_enemy.height());
    m_Rect.moveTo(m_x,m_y);
}
void enemyplane::updateposition()
{
    if(m_free){
        return;
    }
    m_y += m_speed;
    m_Rect.moveTo(m_x, m_y);
    if(m_y >= GAME_HEIGHT + m_Rect.height()){
        m_free = true;
    }
}
